# Contributor: David Demelier <markand@malikania.fr>
# Maintainer: David Demelier <markand@malikania.fr>
pkgname=wesnoth
pkgver=1.16.9
_major=${pkgver%.*}
pkgrel=0
pkgdesc="turn-based strategy game in fantasy world"
url="https://www.wesnoth.org"
arch="all !riscv64" # textrel on rv64
license="GPL-2.0-only"
makedepends="
	boost-dev
	cairo-dev
	cmake
	dbus-dev
	fontconfig-dev
	libvorbis-dev
	openssl-dev>3
	pango-dev
	readline-dev
	samurai
	sdl2-dev
	sdl2_image-dev
	sdl2_mixer-dev
	"
subpackages="$pkgname-doc"
source="https://sourceforge.net/projects/wesnoth/files/wesnoth-$_major/wesnoth-$pkgver/wesnoth-$pkgver.tar.bz2
	fix-cstdint.patch
	"
options="!check" # No tests

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=Release \
		$CMAKE_CROSSOPTS
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
6dac161d7215c9d1ab26da2b6573234d9bf71f4d9bd22f11613328af76d319daad3445a36d0e525be547494d98296d5dca6e0cb603f1a64ba7ea6b7590f5a6f2  wesnoth-1.16.9.tar.bz2
984fe694ded965626c6092abb70b403e07e851ed0035da4e4b3323f7663605566182f7f27c7731f76db7af75fb7728f9c89e191c31f8faf50bb578cfea9b5d02  fix-cstdint.patch
"
